#ifndef    __HA_485_H__
#define    __HA_485_H__

#include "at32f403a_407.h"


#define CONVER_TIME    5
#define UART4_MAX      97


enum{
	RECVING = 0,
	RECVEND = 1,
	DEALING = 2,
	SENDING = 3,
	SENDEND = 4,
	WAITING = 5,
};

typedef struct st_uart4{
	uint8_t rx_buf[UART4_MAX];
	uint8_t conversion_time;
	uint8_t rx_cnt;
	uint8_t status;
}st_uart4;




extern st_uart4 st_485;
void rs485_init(void);
void rs485_to_rx_mode(void);
void rs485_send_data(uint8_t* buf, uint16_t cnt);


#endif


